home *** CD-ROM | disk | FTP | other *** search
- //-------------------------------------------------------------------//
-
- // Synopsis: Block tridiagonal matrix from Poisson's equation.
-
- // Syntax: A = poisson ( N )
-
- // Dexcription:
-
- // A is the block tridiagonal matrix of order N^2 resulting from
- // discretizing Poisson's equation with the 5-point operator on
- // an N-by-N mesh.
-
- // Reference:
- // G.H. Golub and C.F. Van Loan, Matrix Computations, second edition,
- // Johns Hopkins University Press, Baltimore, Maryland, 1989
- // (Section 4.5.4).
-
- // This file is a translation of poisson.m from version 2.0 of
- // "The Test Matrix Toolbox for Matlab", described in Numerical
- // Analysis Report No. 237, December 1993, by N. J. Higham.
-
- // Dependencies
- require tridiag kron
-
- //-------------------------------------------------------------------//
-
- poisson = function ( n )
- {
- local (n)
-
- S = tridiag(n,-1,2,-1);
- I = eye(n,n);
- A = kron(I,S) + kron(S,I);
-
- return A;
- };
-